//microcommand define kick
signature("<user:user>", { showWarning: true, checkUnknown: true, authority: 3 })
option("guild", "-g <id>", { descPath: "lnnbot.admin.guild-option", authority: 3 })
option("yes", "-y", { descPath: "lnnbot.admin.yes-option" })
option("block", "-b")
action(async ({ session, options }, user) => {
if (!user) return session.text("internal.insufficient-arguments")
const [, platform, userId] = /([^:]*):(.*)/.exec(user)
if (platform !== session.platform) return session.text("lnnbot.admin.invalid-user-platform")
const u = await session.bot.getGuildMember(options.guild || session.guildId, userId).catch(() => null)
if (!options.yes) {
session.send(session.text(".confirm", [u?.nick || u?.user?.name || u?.user?.username || u?.user?.id || u?.user?.userId || userId]))
if (!["Y", "y"].includes((await session.prompt())?.trim())) return session.text(".cancelled")
}
await session.bot.kickGuildMember(options.guild || session.guildId, userId, !!options.block)
await session.send(session.text(".done"))
})
locale("zh-CN", {
description: "将用户移出群组",
options: {
block: "禁止该用户再申请加入",
},
messages: {
confirm: "确定将 {0} 移出群组吗？回复 y 以确认",
cancelled: "已取消操作。",
done: "完成。",
},
})